﻿# CMakeList.txt: aimiraSL 的 CMake 项目，在此处包括源代码并定义
# 项目特定的逻辑。
#
cmake_minimum_required (VERSION 3.8)

project ("aimiraSL")
 

# 设置项目名
#project(AMIRA-STRUCTURE-LIGHT  LANGUAGES CXX CUDA)
#find_package(CUDA)
set(CMAKE_BUILD_TYPE "Release")
#set(CMAKE_BUILD_TYPE "Debug")
#set(CMAKE_CUDA_FLAGS ${CMAKE_CUDA_FLAGS} "-g -G") 
# if(CMAKE_BUILD_TYPE STREQUAL "Debug")
#     target_compile_options(add PRIVATE $<$<COMPILE_LANGUAGE:CUDA>:-G>)
# endif()
# 头文件和源文件
file(GLOB INCLUDE  ${CMAKE_CURRENT_SOURCE_DIR}/include/*.h)
file(GLOB INCLUDECUDA  ${CMAKE_CURRENT_SOURCE_DIR}/includeCuda/*.cuh)
file(GLOB SOURCE  ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp )
file(GLOB SOURCECUDA  ${CMAKE_CURRENT_SOURCE_DIR}/cuda/*.cu )

# 设置VS显示头文件
source_group("Header Files" FILES ${INCLUDE})
# 设置头文件 include目录下
include_directories(INCLUDE)
include_directories(INCLUDECUDA)
# 设置源文件 src目录下
aux_source_directory(src DIRS)  

# set(OpenCV_DIR "D:\\Libs\\opencv")
# set(OpenCV_DIR   C:/Work/02Project/opencv/opencv/newbuild/install)#由于下载OpenCV时是自定义路径，所以要set OpenCV_DIR
set(OpenCV_DIR   C:/Work/02Project/opencv/opencv/3_4_16/opencv/build)#由于下载OpenCV时是自定义路径，所以要set OpenCV_DIR
find_package( OpenCV REQUIRED )#找到OpenCV的位置
include_directories( ${OpenCV_INCLUDE_DIRS} ${OPENGL_INCLUDE_DIRS} )#引用
find_package(OpenCV REQUIRED COMPONENTS)
include_directories( ${OpenCV_INCLUDE_DIRS} )
link_directories(${OpenCV_LIBRARY_DIRS})
add_definitions(${OpenCV_DEFINITIONS}) 

find_package(OpenMP REQUIRED)
if(OPENMP_FOUND)
	message("OPENMP FOUND")
	set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}" )
	set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}" )
	set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}" )
endif()

#SET(EIGEN3_INCLUDE_DIR "C:\\Users\\tianz\\Downloads\\eigen-3.4.0")
SET(EIGEN3_INCLUDE_DIR "C:\\Work\\02Project\\amiraSl\\eigen-3.3.7")
include_directories( ${EIGEN3_INCLUDE_DIR} )

add_executable( 
	main
	# ${INCLUDECUDA}
	${INCLUDE} 
	"src/main.cpp"
	# ${SOURCECUDA}
)

add_executable( 
	calibration
	# ${INCLUDECUDA}
	${INCLUDE} 
	"src/calibration.cpp"
	# ${SOURCECUDA}
)

add_library(
	aimira_sl_api SHARED
	"src/aimira_sl_api.cpp"
	"src/aimira_sl_api.h"
)

target_link_libraries( 
	main 
	${OpenCV_LIBRARIES} 
	#"C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v11.7\\lib\\x64\\cusolver.lib"
)
target_link_libraries( 
	calibration 
	${OpenCV_LIBRARIES} 
 
)
target_link_libraries(
	aimira_sl_api
	${OpenCV_LIBRARIES} 
)

#set_target_properties(main PROPERTIES CUDA_ARCHITECTURES "86")
#target_compile_options(main PRIVATE $<$<COMPILE_LANGUAGE:CUDA>:-g -G>)
#target_compile_definitions(main PRIVATE USECUDA=TRUE)

# cuda_add_executable( 
# 	cuda
# 	${INCLUDE} 
# 	${INCLUDECUDA}
# 	"src/cuda.cpp"
# 	"src/foo.cu"
# )

# cuda_add_executable( 
# 	cudaTest
# 	"src/cuda.cu"
# )
# set_target_properties(cuda PROPERTIES CUDA_ARCHITECTURES "86")

set_property(TARGET main PROPERTY CXX_STANDARD 17)
set_property(TARGET calibration PROPERTY CXX_STANDARD 17)
set_property(TARGET aimira_sl_api  PROPERTY CXX_STANDARD 17)
 
 
